package com.chaofan.websocket.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chaofan.websocket.entity.BetRecord;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface BetRecordMapper extends BaseMapper<BetRecord> {

    @Select("select IFNULL(SUM(pay_price),0) as payPrice FROM admin_user_bet_record where wexin_id=#{wexinId}  and room=#{room} and  period=#{period}")
    Double getUserAllBetRecordPrice(BetRecord betRecord);

    @Select("SELECT id FROM admin_user_bet_record where period=#{period} and wexin_id=#{wexinId} and room=#{room}")
    Long[] getUserAllBetRecord(BetRecord betRecord);

    @Delete("DELETE FROM admin_user_bet_record where id =#{id}")
    int deleteThePeriodAllBetRecord(@Param("id") Long id);
}
